home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / pcl4p341.zip / PCL4P.USR < prev    next >
Text File  |  1993-01-17  |  64KB  |  1,742 lines

  1.  
  2.  
  3.                           Personal Communications Library
  4.  
  5.                                 For Turbo Pascal
  6.  
  7.  
  8.                                     (PCL4P)
  9.  
  10.  
  11.  
  12.                                  USERS MANUAL
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                                   Version  3.4
  19.  
  20.                                   Jan 4,  1993
  21.  
  22.  
  23.  
  24.  
  25.                         This software is provided as-is.
  26.                  There are no warranties, expressed or implied.
  27.  
  28.  
  29.  
  30.  
  31.                               Copyright (C) 1993
  32.                               All rights reserved
  33.  
  34.  
  35.  
  36.                               MarshallSoft Computing, Inc.
  37.                               Post Office Box 4543
  38.                               Huntsville AL 35815
  39.  
  40.                               Voice 205-881-4630
  41.                               FAX   205-881-4630
  42.                               BBS   205-880-9748
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.         PCL4P Users Manual                                     Page 1
  61.                               C O N T E N T S
  62.  
  63.  
  64.  
  65.  
  66.  
  67.          Chapter                                                   Page
  68.  
  69.          1.0 Introduction................................................3
  70.              1.1 User Support............................................4
  71.              1.2 A Typical Application...................................5
  72.              1.3 Installation............................................6
  73.          2.0 Library Organization........................................7
  74.              2.1 Initialization & Termination............................7
  75.              2.2 Configuration...........................................7
  76.              2.3 Modem Control & Status..................................8
  77.              2.4 Serial I/O..............................................8
  78.              2.5 Error Detection.........................................9
  79.              2.6 General Support.........................................9
  80.          3.0 Library Overview...........................................10
  81.              3.1 Using the Library......................................10
  82.              3.2 Example Programs.......................................10
  83.              3.3 Compiling & Linking....................................11
  84.          4.0 Talking to Your Modem......................................12
  85.              4.1 Modem Standards........................................12
  86.              4.2 Flow Control...........................................13
  87.              4.3 Modem Initialization...................................14
  88.          5.0 Problems...................................................15
  89.          6.0 Serial Communications......................................16
  90.              6.1 Communications Basics..................................16
  91.              6.2 Standard Port Addresses................................17
  92.              6.3 Running 3 or 4 Ports Concurrently......................18
  93.              6.4 RS232 Signals..........................................19
  94.              6.5 National INS8250, INS16450, and INS16550 UARTs.........20
  95.              6.6 Register Summary.......................................21
  96.          7.0 Terminal Emulator Program (TERM)...........................23
  97.          8.0 Legal Issues...............................................24
  98.              8.1 Registration...........................................24
  99.              8.2 License................................................24
  100.              8.3 Warranty...............................................25
  101.          9.0 Summary....................................................26
  102.              9.1 Revision History.......................................26
  103.              9.2 Function Summary.......................................28
  104.              9.3 Further Reading........................................28
  105.         10.0 Other MarshallSoft Computing products......................29
  106.              10.1 The Personal Communications Library for C.............29
  107.              10.2 The Personal Protocol Library for C...................29
  108.              10.3 The Personal Protocol Library for Pascal..............29
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.         PCL4P Users Manual                                     Page 2
  121.          1.0 Introduction
  122.  
  123.  
  124.          The Personal Communications Library for Turbo Pascal (PCL4P) is an
  125.          asynchronous  communications  library  designed  for   experienced
  126.          software  developers  programming in Turbo Pascal, version 4.0 and
  127.          up. The PCL features:
  128.  
  129.          o 30 communications and support functions.
  130.          o Support for the high performance INS16550 UART.
  131.          o Supports hardware (RTS/CTS) flow control.
  132.          o Interrupt driven receiver.
  133.          o Supports 300 baud to 115,200 baud.
  134.          o Supports COM1, COM2, COM3, and  COM4.
  135.          o Adjustable receive queues from 8 bytes to 32 KB.
  136.          o Control-BREAK error exit.
  137.          o 17 communications error conditions trapped.
  138.          o Allows 4 ports to run concurrently.
  139.          o Complete modem control & status.
  140.          o Written in assembly language for small size & high speed.
  141.          o Terminal program featuring XMODEM, YMODEM, & YMODEM-G.
  142.  
  143.          Why should you buy PCL4P ? I can give you several good reasons.
  144.  
  145.            COMPLETE - PCL4P is complete since it provides absolute control
  146.                       of the serial ports (including the high  performance
  147.                       INS16550).
  148.  
  149.             COMPACT - PCL4P  is  very compact  at  less  than  6  KB. Your
  150.                       application doesn't carry a lot of excess code.
  151.  
  152.                FAST - PCL4P is fast since it will  run  at  38400  baud  on
  153.                       even  slow  8088 PCs (4.77 MHZ) and at 115200 baud on
  154.                       most everything else.
  155.  
  156.             SUPPORT - If you get stuck,  you talk  to  the programmer  that
  157.                       wrote the code, not a  person  hired  to  answer  the
  158.                       phone.
  159.  
  160.                 BBS - A BBS is  available  (2400  baud  N81)  in  order  to
  161.                       provide immediate support as necessary.
  162.  
  163.          NEWSLETTER - One  year  subscription  to  the  MSC  newsletter
  164.                       discusses communications  problems  and  solutions
  165.                       (published quarterly).
  166.  
  167.               PRICE - You get PCL4P for a very reasonable price !
  168.  
  169.            UPGRADES - Once you buy PCL4P, you can always update to  the  most
  170.                       recent  version  for  little  more  than  the  cost  of
  171.                       sending it out to you.
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.         PCL4P Users Manual                                     Page 3
  181.          1.1 User Support
  182.  
  183.          We want you to be successful in developing your applications using
  184.          PCL4P!  We depend on our customers to let us know what  they  need
  185.          in  a  communications  library.   This  means  we are committed to
  186.          providing the best communications library that we can. If you have
  187.          any suggestions or comments, please let us know.
  188.  
  189.          If  you  are having a problem using PCL4P, call us at 205-881-4630
  190.          between 5 PM and 9 PM CST Monday through Saturday, or  FAX  us  at
  191.          the  same  telephone  number at any time (24 hours).  You can also
  192.          call at other times and leave a message, and call back later for a
  193.          reply. However, we can only answer questions with respect to using
  194.          the PCL4P library. We cannot help you program your application.
  195.  
  196.          You  may  also  call our User Support BBS (2400 baud, no parity, 8
  197.          data bits, 1  stop  bit)  at  205-880-9748  and  leave  a  message
  198.          (address it to the SYSOP).  We will usually have a reply ready for
  199.          you within 24 hours.
  200.  
  201.          The  BBS  is available 24 hours per day except at 2 PM Sundays for
  202.          maintenanace. All files are in standard ZIP format. The  BBS  will
  203.          contain  the latest shareware version of all MarshallSoft products
  204.          as well as related files such as:
  205.  
  206.              BUGS.ZIP  --  Bug report.
  207.              NEWS.ZIP  --  Latest news regarding our products.
  208.  
  209.          The  MarshallSoft  Computing,  Inc.   newsletter  "Comm  Talk"  is
  210.          published quarterly.  It discusses various communications problems
  211.          and   solutions  using  PCL4P  as  well  as  related  information.
  212.          Registered users receive a  one  year  complimentary  subscription
  213.          when first registering and for each update purchased.
  214.  
  215.          Of  course, you can always write to us. You should receive a reply
  216.          within a week or so.
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.         PCL4P Users Manual                                     Page 4
  241.          1.2 A Typical Application
  242.  
  243.  
  244.          In  general,  there  are  two  classes  of applications that use a
  245.          communications library like PCL4P -- those that  use  a  modem  to
  246.          connect  to the outside world and those that connect directly to a
  247.          peripheral device. In either case, a typical  application  program
  248.          using PCL4P might look like the following code outline:
  249.  
  250.  
  251.  
  252.          ******************************************************************
  253.          *                                                                *
  254.          * program YourProgram                                            *
  255.          *                                                                *
  256.          * uses PCL4P;                                                    *
  257.          * ...                                                            *
  258.          * ...                                                            *
  259.          * var Buffer : array[0..1023] of Char;                           *
  260.          * ...                                                            *
  261.          * begin (* YourProgram *)                                        *
  262.          *    RetCode := SioRxBuf(Port,Ofs(Buffer),Seg(Buffer),Size1024); *
  263.          *    RetCode := SioParms(Port,NoParity,OneStopBit,WordLength8);  *
  264.          *    RetCode := SioReset(Port,Baud2400);                         *
  265.          *    ...                                                         *
  266.          *    ... ( application code )                                    *
  267.          *    ...                                                         *
  268.          *    RetCode := SioDone(Port);                                   *
  269.          * end. (* YourProgram *)                                         *
  270.          ******************************************************************
  271.  
  272.  
  273.          In the above example, SioRxBuf is called to set up the a 1024 byte
  274.          receive  buffer; SioParms is called to set up the parity, stop bit
  275.          count, and word length; SioReset is called to set the baud rate to
  276.          2400 and  reset  the  UART  (  Univeral  Asynchronous  Receiver  /
  277.          Transmitter ).
  278.  
  279.          Before  leaving your application, SioDone is called to restore the
  280.          prior state of the serial communications system.
  281.  
  282.          If  you  are  using  a  modem, you also need to be concerned about
  283.          initializing your modem correctly and handling any  required  flow
  284.          control. Refer to the "Talking to Your Modem" chapter for detailed
  285.          information.
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.         PCL4P Users Manual                                     Page 5
  301.          1.3 Installation
  302.  
  303.  
  304.          (1) Before installation of PCL4P , your compiler should already be
  305.          installed  on your system and tested. If you are not familiar with
  306.          makefiles,  refer  to  your  compiler  manual.  Examine  the  file
  307.          "FILES.LST" for a list of all the distribution files.
  308.  
  309.          (2) Make a backup  copy  of  your  distribution  disk.   Put  your
  310.          original distribution disk in a safe place.
  311.  
  312.          (3)  Create  a  work  directory  on your work disk ( normally your
  313.          harddisk ). For example, to create a work directory  named  PCL4P,
  314.          we first log onto the work disk and then type:
  315.  
  316.                                MKDIR PCL4P
  317.  
  318.          (4)  Copy  all the files from your backup copy of the distribution
  319.          disk to your work directory.  For example, to  copy  from  the  A:
  320.          drive to your work directory, we type:
  321.  
  322.                               CD PCL4P
  323.                               COPY A:*.*
  324.  
  325.          (5) Compile SIMPLE.PAS:
  326.  
  327.                               TPC SIMPLE
  328.  
  329.          SIMPLE.PAS should compile without any problems.
  330.  
  331.          (7) The recommended way to  test  SIMPLE  is  to  run  it  on  two
  332.          computers  connected  by a null modem cable.  Whatever is typed on
  333.          one computer should be displayed on the other.
  334.  
  335.          (8) Compile and run TERM.PAS.
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.         PCL4P Users Manual                                     Page 6
  361.          2.0 Library Organization
  362.  
  363.  
  364.          The  PCL4P  library is organized into six categories of functions.
  365.          Refer to the PCL  Reference  Manual  (PCL4P.REF)  for  details  on
  366.          individual functions.
  367.  
  368.  
  369.          2.1 Initialization & Termination
  370.  
  371.  
  372.          There are seven functions in the  initialization  and  termination
  373.          category.   Together,  SioParms,  SioFIFO,  SioRxBuf, and SioReset
  374.          initialize your serial communications  system.   Your  application
  375.          must  call  SioParms  and  SioRxBuf  before  calling SioReset, and
  376.          SioReset must be called before any serial I/O  processing  can  be
  377.          done.
  378.  
  379.          After initialization, SioParms and SioBaud can be called again  to
  380.          change  the communications parameters without resetting the serial
  381.          port. SioFlow can be called to enable hardware flow control.
  382.  
  383.          Before exiting from your  application,  SioDone  must  be  called.
  384.          Failure to call SioDone can crash your system later.
  385.  
  386.          SioRxBuf   -- Sets up receive buffer.
  387.          SioFIFO    -- Sets the interrupt level for the INS16550.
  388.          SioParms   -- Sets parity, stop bits, and word length.
  389.          SioReset   -- Initialize a serial port for processing.
  390.          SioDone    -- Terminates further serial processing.
  391.          SioBaud    -- Sets the baud rate of the selected port.
  392.          SioFlow    -- Enables / disables flow control.
  393.  
  394.  
  395.          2.2 Configuration
  396.  
  397.  
  398.          There  are two functions in the configuration category. SioUART is
  399.          used to change the UART base address for a communications port  to
  400.          a   non-standard  address,  while  SioIRQ  is  used  to  assign  a
  401.          nonstandard  IRQ  line  to  a  port.    (See   the   chapter   IBM
  402.          Communications  Ports  for more details on standard UART addresses
  403.          and IRQ lines).
  404.  
  405.          The configuration functions SioUART  and  SioIRQ  must  be  called
  406.          before  calling  any  other library functions.  Be very careful in
  407.          using these functions.  Remember that your  serial  hardware  must
  408.          support  the  UART  and IRQ that you specify.  Always test any new
  409.          configuration immediately.
  410.  
  411.          SioUART -- Sets the UART base address.
  412.          SioIRQ  -- Assigns an IRQ line and interrupt service to a port.
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.         PCL4P Users Manual                                     Page 7
  421.          2.3 Modem Control & Status
  422.  
  423.  
  424.          There  are  seven  functions  in  the  modem  control  and  status
  425.          category which provide your application with complete control over
  426.          the status and control bits of your modem.
  427.  
  428.          There are two modem control bits, "Data Terminal Ready" (DTR)  and
  429.          "Request  To  Send" (RTS). These bits can be read, set, or cleared
  430.          by SioDTR and SioRTS.
  431.  
  432.          There are four modem status bits, "Data Set Ready"  (DSR),  "Clear
  433.          To  Send"  (CTS), "Ring Indicator" (RI), and "Data Carrier Detect"
  434.          (DCD). SioModem can read any of the  modem  status  bits.  SioDSR,
  435.          SioCTS,  SioRI,  and  SioDCD  can only read their respective modem
  436.          status bit.
  437.  
  438.          Refer to the chapter entitled "RS232 Signals" for a discussion  of
  439.          each of the control and status bits.
  440.  
  441.          SioDTR    -- Set, clear, or read the Data Terminal Ready (DTR) bit.
  442.          SioRTS    -- Sets, clears, or reads the Request to Send (RTS) line.
  443.          SioModem  -- Reads the modem status register.
  444.          SioDSR    -- Reads the Data Set Ready (DSR) modem status bit.
  445.          SioCTS    -- Reads the Clear to Send (CTS) modem status bit
  446.          SioDCD    -- Reads the Data Carrier Detect (DCD) modem status bit.
  447.          SioRI     -- Reads the Ring Indicator (RI) modem status bit.
  448.  
  449.  
  450.          2.4 Serial I/O
  451.  
  452.  
  453.          There are six  library  functions  in  the  serial  I/O  category.
  454.          Together,  these  functions  give  the programmer complete control
  455.          over serial I/O.  Higher level functions  such  as  protocols  and
  456.          smart  modem communications can be completely implemented in terms
  457.          of these functions. Refer to the example code.
  458.  
  459.          SioGetc  and SioPutc perform all the actual serial I/O.  SioUnGetc
  460.          and SioRxFlush modify the receive queue. SioLine can  be  used  to
  461.          test for UART errors.
  462.  
  463.          SioGetc    -- Reads the next character from the serial line.
  464.          SioPutc    -- Transmit a character over a serial line.
  465.          SioUnGetc  -- "Un-gets" (puts back) a specified character.
  466.          SioRxFlush -- Flush (clears) the receive buffer.
  467.          SioRxQue   -- Returns the number of characters in the receive queue.
  468.          SioLine    -- Reads the line status register.
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.         PCL4P Users Manual                                     Page 8
  481.          2.5  Error Detection
  482.  
  483.  
  484.          There are four functions in the error detection category. They are
  485.          concerned with detecting or reporting communications errors.   Use
  486.          of  these  functions  can make your application significantly more
  487.          robust.
  488.  
  489.          SioBrkKey   can   be   used  as  an  "emergency"  exit  from  your
  490.          application. SioBrkSig can read or modify the UART break bit. This
  491.          is useful for signalling the remote system that a fatal  condition
  492.          has  occurred.  SioLoopBack  can  be used to test the integrity of
  493.          your UART.  SioError displays a error message corresponding to  an
  494.          error  code  returned  from a PCL4P function.
  495.  
  496.          SioBrkKey -- Returns non-zero if the Control-BREAK key was pressed
  497.          SioBrkSig -- Asserts, cancels, or detects  BREAK  signal.
  498.          SioError  -- Displays  error  in  text.
  499.          SioLoopBack -- Performs a UART loopback test.
  500.  
  501.  
  502.          2.6 General Support
  503.  
  504.  
  505.          There are two functions in the general support category.  Strictly
  506.          speaking,  they are not communications functions, but they take up
  507.          a very small amount of additional memory.   Registered  users  can
  508.          remove these functions from the library if needed.
  509.  
  510.          SioInfo     -- Returns the library version & memory model.
  511.          SioTimer    -- Returns the number of system clock tics.
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.         PCL4P Users Manual                                     Page 9
  541.          3.0 Library Organization
  542.  
  543.          3.1 Using the Library
  544.  
  545.  
  546.          The  PCL4P  library has been tested on a TANDY 1000 (4.77 MHZ 8088
  547.          IBM PC clone), a TANDY 3000 (80286 IBM AT clone), a  TANDY  1400LT
  548.          (IBM XT clone), and a Gateway 2000 Cache (25 MHZ 80386-DX).  PCL4P
  549.          has been tested under MSDOS 2.11, 3.2, 3.3, 4.01, and 5.0.
  550.  
  551.          Please  examine  the  PCL4P.PAS file. Note that COM1 is defined as
  552.          port zero, not port one.  The user must assume  the  responsibilty
  553.          for  passing the correct information when calling PCL4P functions.
  554.  
  555.  
  556.          3.2 Example Programs
  557.  
  558.  
  559.          Two communications programs are provided as a demonstration of the
  560.          PCL4P library -- SIMPLE and TERM.
  561.  
  562.          SIMPLE  is  provided  as  the  simpliest example of communications
  563.          programming  using  PCL4P.   The  user  should  compile  and  link
  564.          SIMPLE.PAS as a test of the library.
  565.  
  566.          If you have two computers, connect them together with a null modem
  567.          cable and run SIMPLE on both machines.  The baud rate in SIMPLE is
  568.          hard  coded to 2400 baud. It is easily changed in the source code.
  569.          Start SIMPLE by typing SIMPLE followed by the port. For example:
  570.  
  571.               SIMPLE 1
  572.  
  573.          Once SIMPLE is started on both computers, whatever is typed on one
  574.          machine should be displayed on the other, and vice versa.
  575.  
  576.          The  TERM program is a more capable terminal emulator than SIMPLE.
  577.          It features modem initialization, hardware flow control, and  file
  578.          transfer   using   XMODEM,  YMODEM,  and  YMODEM-G  communications
  579.          protocols.  TERM can be used to call up any bulletin board system,
  580.          including the MarshallSoft Computing BBS.  Start  TERM  by  typing
  581.          TERM followed by the port and baud rate. For example:
  582.  
  583.               TERM 4 2400
  584.  
  585.          Refer to the chapter "Terminal Emulator Program"  for  a  complete
  586.          discussion of TERM.
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.         PCL4P Users Manual                                     Page 10
  601.          3.3 Compiling and Linking
  602.  
  603.  
  604.          Registered users may wish to assemble  PCL4PLIB.ASM.  To  assemble
  605.          using the Microsoft assembler:
  606.  
  607.                MASM PCL4PLIB /DPASCAL_MODEL;
  608.  
  609.          To build the library TPU:
  610.  
  611.                TPC PCL4P
  612.  
  613.          To compile the sample programs:
  614.  
  615.                TPC SIMPLE.PAS
  616.  
  617.                TPC TERM.PAS /m
  618.  
  619.          A  makefile (  TERM.MAK  )  is  also  provided  for  the  TERM.PAS
  620.          program. To compile TERM and all dependent units, type:
  621.  
  622.                MAKE -FTERM
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.         PCL4P Users Manual                                     Page 11
  661.          4.0 Talking to Your Modem
  662.  
  663.  
  664.          A modem is  used  to  extend  the  distance  over  which  you  may
  665.          communicate.   Without  a  modem, your RS232 cable is limited to a
  666.          maximum of approximately 50  feet.  But  with  a  modem,  you  can
  667.          communicate literally around the world.
  668.  
  669.  
  670.          4.1 Modem Standards
  671.  
  672.  
  673.          Two modems can communicate over a telephone line only if they  are
  674.          both  using  the  same signaling frequencies and modulation, which
  675.          are determined by the the modem standards used.   Modem  standards
  676.          can  be  divided  into three sets: (1) speed, (2) data compression
  677.          used, and (3) error control.
  678.  
  679.          The Bell standards (103 & 212A) are those of AT&T.  The CCITT (The
  680.          International  Consultative Committee for Telephone and Telegraph)
  681.          standards are designated as "V. ".
  682.  
  683.  
  684.          Speed
  685.  
  686.          Bell 103  --   300 baud
  687.          Bell 212A --  1200 baud
  688.          V.21      --   300 baud
  689.          V.22bis   --  1200 & 2400 baud
  690.          V.32      --  4800 & 9600 baud
  691.          V.32bis   --  4800, 7200, 9600, 12000, and 14400 baud
  692.  
  693.  
  694.          Data Compression
  695.  
  696.          MNP 5     --  Microcom Networking Protocol (proprietary).
  697.          V.42bis   --  International data compression standard.
  698.  
  699.  
  700.          Error Control
  701.  
  702.          MNP 2,3,4 --  Three level error correction (public domain).
  703.          V.42      --  International error correction standard.
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.         PCL4P Users Manual                                     Page 12
  721.          4.2 Flow Control
  722.  
  723.  
  724.          With modems using data compression, the modem to modem  connection
  725.          will  run  at various speeds depending on the quality of the line.
  726.          The computer to modem connection will be at  a  fixed  baud  rate.
  727.          Therefore,  a  protocol (flow control) is necessary to synchronize
  728.          the data flow  between  and  modems  and  the  computer  to  modem
  729.          connection.   Refer  to  your modem manual for information on flow
  730.          control protocols supported.
  731.  
  732.          Two  flow  control  protocols  are  used  by most all modems which
  733.          require flow control. Software flow control is  called  "XON/XOFF"
  734.          (other  software  flow  control  character  pairs  are defined but
  735.          operate the same as XON/XOFF) and hardware flow control is  called
  736.          "RTS/CTS".  Most modems which require flow control enable hardware
  737.          flow control by default.
  738.  
  739.          In   XON/XOFF  (software)  flow  control,  the  computer  suspends
  740.          transmitting data if it receives a XOFF character  (13  hex)  from
  741.          the  modem,  and  continues  transmitting  when  it receives a XON
  742.          character (11 hex).  Similiarly, the computer can signal the modem
  743.          not to send any more data by transmitting a XOFF to  it,  and  can
  744.          tell the modem to continue transmission be sending a XON.
  745.  
  746.          In  RTS/CTS  (hardware)  flow control, the RTS line is used by the
  747.          computer to signal the modem , while the CTS line is used  by  the
  748.          modem  to  signal  the  computer.  The  RTS line is set OFF by the
  749.          computer to tell the modem to suspend transmission, and set to  ON
  750.          to  tell  the modem to continue transmission.  The CTS line is set
  751.          to OFF by the modem to tell the computer to stop transmitting, and
  752.          set to ON to tell the computer to continue transmitting.
  753.  
  754.          Given  the  choice,  always  choose  hardware  flow  control  over
  755.          software   flow   control   so   that  all  data  transmission  is
  756.          transparent.  If hardware flow control is not the  default  (which
  757.          it almost always is), your should modify your modem initialization
  758.          string to turn hardware flow control on.
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.         PCL4P Users Manual                                     Page 13
  781.          4.3 Modem Initialization
  782.  
  783.  
  784.          If your application uses a modem (as opposed to using a null modem
  785.          cable),  then  you  should always send an initialization string to
  786.          your modem if it is a programmable modem such  as  those  made  by
  787.          Hayes.   Communication  programs  such as PROCOMM and TELIX always
  788.          send such a string automatically as soon as they start up.
  789.  
  790.          The particular initialization string depends on the make  of  your
  791.          modem.   For Hayes and Hayes AT command set compatible modems, the
  792.          following string (followed by a carriage return) should work:
  793.  
  794.               AT E1 S7=60 S11=60 V1 X1 Q0 S0=0
  795.  
  796.          Refer to your Modem User's Guide for a full  discussion  of  these
  797.          commands. A brief description is as follows:
  798.  
  799.          AT     Modem attention command.
  800.          E1     Modem will echo what you send to it.
  801.          S7=60  Wait 60 seconds for carrier and/or dial tone.
  802.          S11=60 Use 60 milliseconds for tone dialing duration & spacing.
  803.          V1     Display result code as words (not numbers).
  804.          X1     Use the extended result message (CONNECT XXXX) set.
  805.          Q0     Modem returns result codes.
  806.          S0=0   Do not answer RING.
  807.  
  808.          If your application will answer incoming calls, then  set  the  S0
  809.          register to the ring on which to automatically answer.
  810.  
  811.          If you send the above codes by using SioPutc (as opposed to typing
  812.          them from the keyboard), then follow these guidelines:
  813.  
  814.          (1) Send an initial  carriage  return  before  the  initialization
  815.          string.
  816.  
  817.          (2) Pause at least two tics (18 tics to  the  second)  after  each
  818.          character  sent  as  your  modem needs the time to perform its own
  819.          internal processing.  Pause a little longer if your modem  is  not
  820.          accepting your initialization string.
  821.  
  822.          (3) Pause one and a half seconds after sending any  initialization
  823.          command  such  as ATZ or AT&F since your modem must do quite a bit
  824.          of processing.
  825.  
  826.          If you experience any problems in initializing your  Hayes  modem,
  827.          you should first reset it to factory settings by sending:
  828.  
  829.               AT&F
  830.  
  831.          Refer  to  the  TERM  program (functions SendTo and WaitFor in the
  832.          file MODEM_IO.PAS) for an example  of  sending  an  initialization
  833.          string to a Hayes compatible modem.
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.         PCL4P Users Manual                                     Page 14
  841.          5.0 Problems
  842.  
  843.  
  844.          If  you cannot get your application to run properly, first compile
  845.          and run the  terminal  emulator  program  TERM  provided  on  your
  846.          distribution  disk.   If  you  are  using  a null modem cable or a
  847.          non-programmable modem, be sure not to  define  AT_COMMAND_SET  in
  848.          DEFINES.PAS.  If  you  are using a Hayes compatible modem, then do
  849.          define AT_COMMAND_SET {$DEFINE AT_COMMAND_SET}. If you  are  using
  850.          a  programmable modem which is not Hayes compatible, then you must
  851.          modify the initialization string for your particular modem.
  852.  
  853.          If your application does not run but TERM runs correctly, then you
  854.          have  most  likely made a programming mistake in your application.
  855.          MarshallSoft Computing cannot debug your  application,  especially
  856.          over  the telephone!  However, consider each of the following when
  857.          searching for an error in your application.
  858.  
  859.          1.  Did you include the "uses PCL4P" statement ?
  860.  
  861.          2.  Is your receive buffer large enough ? If you are using 1K data
  862.              blocks in YMODEM, then your receive buffer should be at  least
  863.              1K ( 2K if baud rates above 38400 are to be used ).
  864.  
  865.          4.  Have you selected too high a baud rate ( if you  are  using  a
  866.              slow PC ) ?  If only one COM port is being run, you should  be
  867.              able to run at 38400 baud on 8088 machines and 115200 on  most
  868.              286 and all 386 and 486 machines.
  869.  
  870.          5.  Are  you  attempting  to  run  another  application   in   the
  871.              background ?  Try running  without any other programs  running
  872.              in the background ( unload all TSR programs ).
  873.  
  874.          6.  If you are running two COM ports simultaneously, are you using
  875.              separate receive buffers ? ( you should ).
  876.  
  877.          7.  Did SioReset return a zero value ?  If not, then you must call
  878.              SioReset again. See TERM.PAS for an example.
  879.  
  880.          8.  Did you send the proper initialization string to your modem ?
  881.              Did you set DTR and RTS ? ( you should ).
  882.  
  883.          9.  Do you have more than one COM1 port, etc.  For example, if you
  884.              have a COM1 port on your motherboard,  you cannot add  another
  885.              COM1  port  or  modem  board  that  uses  COM1  without  first
  886.              disabling the COM1 on the motherboard.
  887.  
  888.          Registered  users  can call (205) 881 - 4630 from 5 PM to 9 PM CST
  889.          Monday through Friday for help.
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.         PCL4P Users Manual                                     Page 15
  901.          6.0 Serial Communications
  902.  
  903.          6.1 Communications Basics
  904.  
  905.  
  906.          The  heart  of  serial  communications  is  the  UART   (Universal
  907.          Asynchronous   Receiver   Transmitter).    The  IBM  PC/XT/AT  and
  908.          compatibles use the INS8250, INS16450, or the INS16550 UART.   The
  909.          purpose of the UART is:
  910.  
  911.          (1)  To convert bytes from the CPU (Central Processing Unit), into
  912.          a serial format by adding the necessary start,  stop,  and  parity
  913.          bits  to  each byte before transmission, and to then transmit each
  914.          bit at the correct baud rate.
  915.  
  916.          (2) To convert the incoming stream (at a specified baud  rate)  of
  917.          serial  bits  into  bytes  by removing the start, stop, and parity
  918.          bits before being made available to the CPU.
  919.  
  920.          The  UART  is  part of the serial interface circuitry which allows
  921.          the CPU to send and receive signals over the RS232 lines. This can
  922.          be diagrammed as follows:
  923.  
  924.                                Serial Interface
  925.                             *********************
  926.                             *                   *
  927.          *******  Data Bus  *     ********      *    RS232 Signals
  928.          * CPU **************     * UART *      ******************
  929.          *******            *     ********      *
  930.                             *                   *
  931.                             *********************
  932.  
  933.          The  INS8250/16450/16550  UART  is  capable of operating in one of
  934.          two  modes,  "polled"  and   "interrupt   driven".    The   serial
  935.          communications  functions  in the BIOS uses the polled method.  In
  936.          this approach, the CPU is typically in  a  loop  asking  the  UART
  937.          over  and  over  again  if  it  has a byte ready. If its does, the
  938.          polling code returns the byte.  But, if the  next  byte  comes  in
  939.          before  the  polling  code  is  executing again, then that byte is
  940.          lost.
  941.  
  942.          In  the  interrupt  driven  approach  (used  by PCL4P for incoming
  943.          data), when a byte is received by the UART, an "Interrupt  Service
  944.          Routine"  (ISR)  is  executed  immediately, suspending temporarily
  945.          whatever else is executing.  The ISR then  moves  the  byte  to  a
  946.          buffer  so  that your application program can later read it. Refer
  947.          to the sections entitled "RS232  Signals"  and  "National  INS8250
  948.          UART" for further information on these topics.
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.         PCL4P Users Manual                                     Page 16
  961.          6.2 Standard Port Addresses
  962.  
  963.  
  964.          There  are  a  few  things to know about how serial communications
  965.          ports are used by  IBM  PC/XT/AT  and  compatible  computers.  The
  966.          standard IBM PC/XT/AT configuration values are as follows:
  967.  
  968.          Port     Reg Base   IRQ Line   Vector
  969.          COM1        3F8H        4        12
  970.          COM2        2F8H        3        11
  971.          COM3        3E8H        4        12
  972.          COM4        2E8H        3        11
  973.  
  974.          PCL4P assumes the  above  values.  If  necessary,  the  UART  base
  975.          address    can   be  changed  by  SioUART,  and  IRQ  lines can be
  976.          re-assigned by SioIRQ. Refer to the  PCL4P  Reference  Manual  for
  977.          specific details.
  978.  
  979.          When installing new communications cards, the following guidelines
  980.          are recommended:
  981.  
  982.          (1) Be sure to read the documentation  for  the  hardware  you  are
  983.          installing.   Pay special attention to UART base addresses and IRQ
  984.          lines.
  985.  
  986.          (2) If you have a choice in base addresses and IRQ  lines,  always
  987.          choose standard values as defined above.
  988.  
  989.          (3) The first port should be COM1, the second COM2, etc.
  990.  
  991.          (4)  Use  SioUART  to  zero  all  unused ports (for example, call
  992.          SioUART(COM4,0) if there is no COM4 port installed).
  993.  
  994.          (5)  Be  carefull not to configure two ports for the same address.
  995.          This is easier to do than you may believe.
  996.  
  997.          (6) Choose an external modem over an internal  one.   It  is  much
  998.          easier  to  debug problems with an external modem than an internal
  999.          one.
  1000.  
  1001.          (7)  Select  hardware  flow  control  (RTS/CTS) if flow control is
  1002.          required and hardware flow control is not the default.
  1003.  
  1004.          (8) Always test your port as soon as it is installed.
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.         PCL4P Users Manual                                     Page 17
  1021.          6.3 Running 3 or 4 Ports Concurrently
  1022.  
  1023.  
  1024.          PCL4C  supports  up  to  4  serial ports running concurrently. One
  1025.          free interrupt for each port is required.
  1026.  
  1027.          Interrupts IRQ4 and IRQ3 are dedicated to the communications ports
  1028.          in a standard IBM PC/XT/AT configuration.  IRQ4 is shared  between
  1029.          COM1  and  COM3  while IRQ3 is shared between COM2 and COM4.  This
  1030.          means that you can run two ports simultaneously provided that they
  1031.          don't share an interrupt.
  1032.  
  1033.          Suppose that you wish to run 3 ports simultaneously. To begin, you
  1034.          must have 3 serial UARTs installed on your computer.  Assume,  for
  1035.          purposes  of  this  discussion,  that  COM1  is  installed on your
  1036.          motherboard,  and  that  you  have  purchased   a   new   2   port
  1037.          serial communications board.
  1038.  
  1039.          You  should  be  able  to configure the first serial board port as
  1040.          COM2, which uses IRQ3.  Refer to the manual that  came  with  your
  1041.          serial board.
  1042.  
  1043.          In  order to run the third serial port concurrently with the first
  1044.          two, a unused interrupt must be found.  If your  serial  card  can
  1045.          only  use  IRQ3 and IRQ4, then there is no way to run a third line
  1046.          since IRQ4 and IRQ3 are used for COM1 and COM2.
  1047.  
  1048.          However,  many  serial  cards  can  use other IRQs, typically IRQ2
  1049.          through IRQ5. Since IRQ5 is normally used  for  a  second  printer
  1050.          port,  it  is a good candidate for COM3. To use IRQ5 for the third
  1051.          serial port, first set your serial  card  to  use  IRQ5  for  COM3
  1052.          (refer to your serial card manual) and then add the following line
  1053.          to your applications code before calling SioReset:
  1054.  
  1055.                 RetCode := SioIRQ(COM3,IRQ5,ThirdISR);
  1056.  
  1057.          Don't forget to disable any device that might use IRQ5, such as  a
  1058.          second  printer  port or a music card.  Unfortunately, there is no
  1059.          easy way to  determine  that  you  have  no  conflicts  until  you
  1060.          actually  attempt  to  use  the  IRQ. If there are conflicts, your
  1061.          system will probably hang and you will have to reboot.
  1062.  
  1063.          To run a fourth serial port, another free IRQ must  be  found.  On
  1064.          some  systems, IRQ2 can be used. To use IRQ2 for the fourth serial
  1065.          port, first set your serial card to use IRQ2  for  COM4  and  then
  1066.          add:
  1067.  
  1068.                 RetCode := SioIRQ(COM4,IRQ2,FourthISR);
  1069.  
  1070.          To summarize, your serial  card  must  be  able  to  generate  the
  1071.          correct  IRQ,  which is not already being used. Refer to the entry
  1072.          for the SioIRQ function in the PCL4C Reference Manual.
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.         PCL4P Users Manual                                     Page 18
  1081.          6.4 RS-232 Signals
  1082.  
  1083.  
  1084.          RS-232 is the name of the serial data interface standard  used  to
  1085.          connect  computers  to  modems.  Most IBM compatible computers are
  1086.          built with at least one serial port and use either DB9 (9 pin)  or
  1087.          DB25 (25 pin) connectors.
  1088.  
  1089.          A summary of these pins and  their  function  follows.   For  more
  1090.          detailed  information, refer to one of the many books dealing with
  1091.          RS-232 interfacing.
  1092.  
  1093.          Signal Ground Pin 7 (DB25), Pin 5 (DB9)
  1094.  
  1095.          The SG line is used as the common signal ground, and  must  always
  1096.          be connected.
  1097.  
  1098.          Transmit Data Pin 2 (DB25), Pin 3 (DB9)
  1099.  
  1100.          The TX line is used to carry data from the computer to the modem.
  1101.  
  1102.          Receive Data Pin 3 (DB25), Pin 2 (DB9)
  1103.  
  1104.          The RX line is used to carry data from the modem to the computer.
  1105.  
  1106.          Data Terminal Ready Pin 20 (DB25), Pin 4 (DB9)
  1107.  
  1108.          The  DTR  line is used by the computer to signal the modem that it
  1109.          is ready. DTR should be set high when talking to a modem.
  1110.  
  1111.          Data Set Ready Pin 6 (DB25), Pin 6 (DB9)
  1112.  
  1113.          The DSR line is used by the modem to signal the computer  that  it
  1114.          is ready.
  1115.  
  1116.          Request to Send Pin 4 (DB25), Pin 7 (DB9)
  1117.  
  1118.          The  RTS  line  is  used  to "turn the line around" in half duplex
  1119.          modems, and for hardware flow control in most modems that  require
  1120.          flow control.
  1121.  
  1122.          Clear to Send Pin 5 (DB25), Pin 8 (DB9)
  1123.  
  1124.          The  CTS  line  is  used  to "turn the line around" in half duplex
  1125.          modems, and for hardware flow control in most modems that  require
  1126.          flow control.
  1127.  
  1128.          Data Carrier Detect Pin 8 (DB25), Pin 1 (DB9)
  1129.  
  1130.          The DCD line is used by the modem to signal the  computer  that  a
  1131.          data carrier signal is present.
  1132.  
  1133.          Ring Indicator Pin 22 (DB25), Pin 9 (DB9)
  1134.  
  1135.          The RI line is asserted when a 'ring' occurs.
  1136.  
  1137.  
  1138.  
  1139.  
  1140.         PCL4P Users Manual                                     Page 19
  1141.          6.5 National INS8250, INS16450, and INS16550 UARTs
  1142.  
  1143.  
  1144.          The  Personal  Communications  Library  is  based  on the standard
  1145.          National INS8250, INS16450, and INS16550 UARTs. The 8250  was  the
  1146.          original  UART  used  in the IBM PC, whereas the 16450 is a faster
  1147.          version found on most 286 & up machines. The 16550 contains  a  16
  1148.          byte  FIFO  to further reduce communications overhead. These UARTs
  1149.          consists of 8 register ports as follows:
  1150.  
  1151.          Offset    R/W   Register
  1152.            0       R/W   Receiver (read) / Transmitter (write)
  1153.            1       R/W   Interrupt Enable (read)
  1154.            2       R     Interrupt Identification
  1155.            2       W     FIFO control (INS16550 only)
  1156.            3       R/W   Data Format (Line Control)
  1157.            4       R/W   RS-232 (Modem) Control
  1158.            5       R/W   Line Status
  1159.            6       R/W   RS-232 (Modem) Status
  1160.            7       R/W   Not used.
  1161.  
  1162.          The  UART  registers  are  based  at  3F8  (COM1), 2F8 (COM2), 3E8
  1163.          (COM3), and 2E8 (COM4). COM1 and COM3 share  interrupt  vector  12
  1164.          and  interrupt  request  line  IRQ4  while  COM2  and  COM4  share
  1165.          interrupt vector 11 and interrupt request line IRQ3.   This  means
  1166.          that  COM1  and  COM3  cannot  both  be  used  at  the  same time.
  1167.          Similarly, COM2 and COM4 cannot both be used at the same time.
  1168.  
  1169.  
  1170.          Port     Reg Base   IRQ Line   Vector
  1171.          COM1        3F8H        4        12
  1172.          COM2        2F8H        3        11
  1173.          COM3        3E8H        4        12
  1174.          COM4        2E8H        3        11
  1175.  
  1176.          Four sources of interrupts are possible with the 8250  and  16550:
  1177.          (1) receiver error or BREAK, (2) receiver data ready, (3) ready to
  1178.          transmit,  and  (4) RS232 input.  These four sources of interrupts
  1179.          are summarized as follows:
  1180.  
  1181.          Source of Interrupt        Action Required to Clear
  1182.          Receiver error or BREAK.   Read Line Status register.
  1183.          Receiver data.             Read data from data register.
  1184.          Transmitter Buffer Empty.  Write to data register or read IID reg.
  1185.          RS232 input.               Read Modem Status register.
  1186.  
  1187.          However,  PCL4P  only  enables  the receiving data interrupt. This
  1188.          means that interrupts can only be caused by incoming data.
  1189.  
  1190.          If  you  are not familiar with the INS8250, several good books are
  1191.          available.   Refer  to  the  Serial  Communications  chapter   for
  1192.          recommendations.    Although  a  knowledge  of  the  8250  is  not
  1193.          necessary to use PCL4P, a  general  knowledge  of  the  theory  of
  1194.          asynchronous serial communications is recommended.
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.         PCL4P Users Manual                                     Page 20
  1201.          6.6 Register Summary
  1202.  
  1203.  
  1204.          REG 0 : Data Register
  1205.  
  1206.          Reading  from  the data register fetches the next input byte, once
  1207.          it is ready.  Writing to the  data  register  transmits  the  byte
  1208.          written to it over the serial line.
  1209.  
  1210.          REG 1 : Interrupt Enable
  1211.  
  1212.          The  Interrupt  Enable  register  enables  each  of  four types of
  1213.          interrupts when the appropriate bit is set to a one.
  1214.  
  1215.          bit 3 : Enable interrupt on RS232 input.
  1216.          bit 2 : Enable interrupt on receiver error or break.
  1217.          bit 1 : Enable interrupt on transmitter buffer empty (TBE).
  1218.          bit 0 : Enable interrupt on received data (RxRDY).
  1219.  
  1220.          REG 2 : Interrupt Identification (IID)
  1221.  
  1222.          Reading  the  Interrupt Identification (read only) register once
  1223.          an interrupt has occurred identifies the interrupt as follows:
  1224.  
  1225.          Bit 2  Bit 1  Bit 0  Priority    Interrupt
  1226.            0      0      1      none      none
  1227.            1      1      0      0 (high)  Serialization or break.
  1228.            1      0      0      1         Received data.
  1229.            0      1      0      2         Transmitter Buffer Empty.
  1230.            0      0      0      3 (low)   RS232 Input.
  1231.  
  1232.          In the INS16650, REG 2 (write  only)  is  also  the  FIFO  control
  1233.          register.   Writing  bits  6  &  7 will set the FIFO trigger level
  1234.          (number of bytes received before an interrupt is generated).
  1235.  
  1236.          Bit 7  Bit 6   Trigger             Bit 7  Bit 6   Trigger
  1237.           0      0      1 byte               1      1      8 bytes
  1238.           0      1      4 bytes              1      1      14 bytes
  1239.  
  1240.          REG 3 : Line Control
  1241.  
  1242.          RS232 line parameters are selected by writing to this register.
  1243.  
  1244.          bit 7 : DLAB = 0
  1245.          bit 6 : BREAK on(1), off(0).
  1246.          bits 5-3: Parity None(000),ODD(001),EVEN(011),MARK(101),SPACE(111)
  1247.          bit 2 : One stop bit(0), two stop bits(1).
  1248.          bits 1-0: Data bits = 5 (00), 6(01), 7(10), 8(11).
  1249.  
  1250.          When the Divisor Latch Access Bit (DLAB) is 1, registers 0  and  1
  1251.          become the LS and MS bytes of the Baud Rate Divisor registers.
  1252.  
  1253.          Baud   Divisor      Baud  Divisor      Baud  Divisor
  1254.           300    0180        4800   0018       38400   0003
  1255.          1200    0060        9600   000C       57600   0002
  1256.          2400    0030       19200   0006      115200   0001
  1257.  
  1258.  
  1259.  
  1260.         PCL4P Users Manual                                     Page 21
  1261.          REG 4 : Modem Control
  1262.  
  1263.          RTS, DTR, loopback testing, and General Purpose Outputs #1 and  #2
  1264.          are controlled by the Modem Control register as follows:
  1265.  
  1266.          bit 4 : Enable local loopback.
  1267.          bit 3 : Enable GP02. Necessary for 8250 interrupts.
  1268.          bit 2 : Enable GP01.
  1269.          bit 1 : Set / clear RTS.
  1270.          bit 0 : Set / clear DTR.
  1271.  
  1272.          REG 5 : Line Status
  1273.  
  1274.          Reading  the  Line  Status register provides status information as
  1275.          follows (1 for TRUE, 0 for FALSE) :
  1276.  
  1277.          bit 6 : Transmitter Empty.
  1278.          bit 5 : Transmitter Buffer Empty (TBE).
  1279.          bit 4 : BREAK detect.
  1280.          bit 3 : Framing error.
  1281.          bit 2 : Parity error.
  1282.          bit 1 : Overrun error.
  1283.          bit 0 : Data Ready.
  1284.  
  1285.          REG 6 : Modem Status
  1286.  
  1287.          Reading the Modem Status register provides  the  following  status
  1288.          information (1 for TRUE, 0 for FALSE) :
  1289.  
  1290.          bit 7 : DCD status.
  1291.          bit 6 : RI status.
  1292.          bit 5 : DSR status.
  1293.          bit 4 : CTS status.
  1294.          bit 3 : Delta DCD status.
  1295.          bit 2 : Delta RI status.
  1296.          bit 1 : Delta DSR status.
  1297.          bit 0 : Delta CTS status.
  1298.  
  1299.          The delta bits (bits 0 through 3) are  set  whenever  one  of  the
  1300.          status  bits  (bits 4 through 7) changes (from 0 to 1 or from 1 to
  1301.          0) since the last time that the Modem Status  register  was  read.
  1302.          Reading the Modem Status register clear the delta bits.
  1303.  
  1304.          REG 7 : Scratch Register
  1305.  
  1306.          There is no function associated with  register  7.   It  does  not
  1307.          exist in early versions of the 8250.
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.         PCL4P Users Manual                                     Page 22
  1321.          7.0 Terminal Emulator Example Program
  1322.  
  1323.  
  1324.          TERM is an communications program suitable for calling up bulletin
  1325.          board  systems  (BBS)  and  performing  as  a  PC  to PC file copy
  1326.          program.  TERM itself is not part of the  communications  library,
  1327.          but  rather  it  is  provided  as  an  example of a communications
  1328.          application using PCL4P.
  1329.  
  1330.          TERM can send a standard Hayes standard AT command set  string  to
  1331.          your  modem.   An  initialization  string is sent by TERM provided
  1332.          that AT_COMMAND_SET is defined in DEFINES.PAS.
  1333.  
  1334.             {$DEFINE AT_COMMAND_SET}
  1335.  
  1336.          Refer to the chapter "Modem Initialization" for  a  discussion  of
  1337.          initialization strings.
  1338.  
  1339.          TERM  also supports hardware flow control (RTS/CTS). Hardware flow
  1340.          control is observed provided that the constant RTS_CTS_CONTROL  is
  1341.          defined in the file DEFINES.PAS.
  1342.  
  1343.             {$DEFINE RTS_CTS_CONTROL}
  1344.  
  1345.          Refer to the chapter "Flow Control" for a discussion  of  hardware
  1346.          flow control.
  1347.  
  1348.          TERM  can  also  exchange  files  using  XMODEM,   YMODEM   (batch
  1349.          capability),  and  YMODEM-G  (streaming  YMODEM  used  with  error
  1350.          correcting modems)  communications  protocols.   TERM  can  accept
  1351.          wildcards in the filename so that multiple files can be sent using
  1352.          YMODEM  and  YMODEM-G.   The  protocol timing can also be adjusted
  1353.          (this  should  not  be  necessary)  by  modifying  the   constants
  1354.          SHORT_WAIT and LONG_WAIT in the PCL4P.PAS file.
  1355.  
  1356.          TERM  can also be used as a PC to PC transfer program using a null
  1357.          modem cable. In  this  case,  AT_COMMAND_SET  and  RTS_CTS_CONTROL
  1358.          should not be defined in the file DEFINES.PAS:
  1359.  
  1360.          Be  advised  that  most  null modem cables are do NOT swap RTS and
  1361.          CTS, which is necessary for hardware flow control. This means that
  1362.          RTS_CTS_CONTROL should never be defined when using  a  null  modem
  1363.          cable unless you are absolutely sure that RTS and CTS are swapped.
  1364.  
  1365.          To start TERM, type TERM followed by the port (1  to  4)  and  the
  1366.          baud  rate (300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600,
  1367.          or 115200). For example, to start TERM at 2400 baud on port COM4:
  1368.  
  1369.             TERM 4 2400
  1370.  
  1371.          The TERM program (but of course not the library itself) is  placed
  1372.          in  the  public domain by MarshallSoft Computing, Inc., and can be
  1373.          used in any way desired by the user.
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.         PCL4P Users Manual                                     Page 23
  1381.          8.0 Legal Issues
  1382.  
  1383.          8.1 Registration
  1384.  
  1385.  
  1386.          The shareware version of PCL4P.LIB is provided  so  that  you  may
  1387.          personally  determine  the usefulness of the product for yourself.
  1388.          If you can use  the  Personal  Communications  Library  for  Turbo
  1389.          Pascal  ,  please  register your use with us. Send $55 plus $3 S&H
  1390.          ($6 outside of North America) to:
  1391.  
  1392.                   MarshallSoft Computing, Inc.
  1393.                   Post Office Box  4543
  1394.                   Huntsville AL 35815
  1395.  
  1396.  
  1397.          We accept  American  Express  (account  number,  expiration  date,
  1398.          exact  name  on  your  card,  and  AmEx billing address required),
  1399.          checks in US dollars drawn on a US  bank,  purchase  orders  (POs)
  1400.          from   recognized  US  schools  and  companies  listed  in  Dun  &
  1401.          Bradstreet, and COD (street address  and  phone  number  required)
  1402.          within  the  USA (plus a $3 COD charge).  Print the file PCL4C.INV
  1403.          if an invoice is needed. The registered package  is  mailed  first
  1404.          class US Mail (packet air mail overseas).
  1405.  
  1406.          The registered package includes:
  1407.  
  1408.          o  Assembler source code for the library.
  1409.          o  Printed Users Manual.
  1410.          o  Printed Reference Manual.
  1411.          o  Telephone, FAX, BBS support for one year.
  1412.          o  One year subscription (quarterly) to MSC newsletter.
  1413.          o  EXAMPORT -- Free utility which displays  a  detailed  formatted
  1414.             report  for  any  serial port. For example, to display a report
  1415.             for COM1, type "EXAMPORT 1".
  1416.  
  1417.          EXAMPORT is not sharware and  is  available  only  for  registered
  1418.          users of MarshallSoft products.
  1419.  
  1420.          All updates (with printed manuals) are $15 plus $3 S&H ($6 outside
  1421.          of North America).
  1422.  
  1423.          PCL4PLIB.ASM  is  the source code for the library. The source code
  1424.          is copyrighted by MarshallSoft Computing, Inc. The user is granted
  1425.          a license to use the PCL4P object  code  in  his  own  application
  1426.          only.  PCL4PLIB.ASM  is not shareware and may not be sold or given
  1427.          away to anyone.
  1428.  
  1429.          The registered user will receive the latest version  of  PCL4P  by
  1430.          return  mail.  A 5.25" diskette is provided unless a 3.5" diskette
  1431.          is requested.
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.         PCL4P Users Manual                                     Page 24
  1441.          8.2 License
  1442.  
  1443.  
  1444.  
  1445.          MarshallSoft  Computing,  Inc. grants the registered user of PCL4P
  1446.          the right to use one copy of the PCL4P library (in object form) on
  1447.          a single computer in  the  development  of  any  software  product
  1448.          without  any  royalties.  The user may not use the library on more
  1449.          than one computer at the same  time.   The  source  code  for  the
  1450.          library (PCL4PLIB.ASM) may not be released in whole or in part.
  1451.  
  1452.  
  1453.          8.3 Warranty
  1454.  
  1455.  
  1456.          MARSHALLSOFT COMPUTING, INC. DISCLAIMS ALL WARRANTIES RELATING  TO
  1457.          THIS  SOFTWARE,  WHETHER  EXPRESSED  OR IMPLIED, INCLUDING BUT NOT
  1458.          LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY  AND  FITNESS
  1459.          FOR  A  PARTICULAR  PURPOSE, AND ALL SUCH WARRANTIES ARE EXPRESSLY
  1460.          AND SPECIFICALLY DISCLAIMED. NEITHER MARSHALLSOFT COMPUTING,  INC.
  1461.          NOR ANYONE ELSE WHO HAS BEEN INVOLVED IN THE CREATION, PRODUCTION,
  1462.          OR  DELIVERY  OF  THIS  SOFTWARE SHALL BE LIABLE FOR ANY INDIRECT,
  1463.  
  1464.          CONSEQUENTIAL, OR INCIDENTAL DAMAGES ARISING OUT  OF  THE  USE  OR
  1465.          INABILITY  TO  USE  SUCH  SOFTWARE EVEN IF MARSHALLSOFT COMPUTING,
  1466.          INC.  HAS BEEN ADVISED OF  THE  POSSIBILITY  OF  SUCH  DAMAGES  OR
  1467.          CLAIMS. IN NO EVENT SHALL MARSHALLSOFT COMPUTING, INC.'S LIABILITY
  1468.          FOR ANY SUCH DAMAGES EVER EXCEED THE PRICE PAID FOR THE LICENSE TO
  1469.          USE  THE SOFTWARE, REGARDLESS OF THE FORM OF THE CLAIM. THE PERSON
  1470.          USING  THE  SOFTWARE  BEARS  ALL  RISK  AS  TO  THE  QUALITY   AND
  1471.          PERFORMANCE OF THE SOFTWARE.
  1472.  
  1473.          Some  states  do not allow the exclusion of the limit of liability
  1474.          for consequential or incidental damages, so the  above  limitation
  1475.          may not apply to you.
  1476.  
  1477.          This  agreement  shall  be  governed  by  the laws of the State of
  1478.          Alabama and shall inure to the benefit of Marshallsoft  Computing,
  1479.          Inc.   and  any successors, administrators, heirs and assigns. Any
  1480.          action or proceeding brought by either  party  against  the  other
  1481.          arising  out of or related to this agreement shall be brought only
  1482.          in a STATE or FEDERAL COURT of competent jurisdiction  located  in
  1483.          Madison County, Alabama. The parties hereby consent to in personam
  1484.          jurisdiction of said courts.
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.         PCL4P Users Manual                                     Page 25
  1501.          9.0 Summary
  1502.  
  1503.          9.1 Revision History
  1504.  
  1505.  
  1506.          Version 1.0 -- 14 January 1991 -- original release.
  1507.  
  1508.          Version 1.1 -- 11 March 1991
  1509.  
  1510.          o  Added SioUnGetc() function to library.
  1511.  
  1512.          Version 1.2 -- 1 June 1991
  1513.  
  1514.          o  Name changed to Personal Communications Library.
  1515.          o  Minor bug fixes.
  1516.  
  1517.          Version 1.3 -- 1 July 1991
  1518.  
  1519.          o  Added NORESET option to SioReset.
  1520.          o  Added SioDSR, SioCTS, SioDCD, and SioRI.
  1521.          o  Added SioLoopBack function to library.
  1522.          o  Added LOOPBACK.PAS example program.
  1523.  
  1524.          Version 2.0 -- 1 Nov 1991
  1525.  
  1526.          o  All example code released in shareware package.
  1527.          o  Fixed bug due to Microsoft Assembler (MASM 5.0,5.1) error.
  1528.  
  1529.          Version 3.0 -- 15 Jan 1991
  1530.  
  1531.          o  Added XMODEM & YMODEM to example code.
  1532.          o  Added SioUART function.
  1533.          o  Added "UART undefined" error code.
  1534.          o  Added "Bad or missing UART" error code.
  1535.          o  Added "Port already enabled" error code.
  1536.          o  Added "Cannot enable both COM1 & COM3 ..." error code.
  1537.          o  Fixed several minor bugs ( using new automated testing ).
  1538.  
  1539.          Version 3.1 -- 1 March 1992
  1540.  
  1541.          o  Added SioFIFO ( INS16550 only ).
  1542.          o  Added SioIRQ function.
  1543.          o  Increased maximum receive buffer size to 32K bytes.
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.         PCL4P Users Manual                                     Page 26
  1561.          Version 3.2 -- 1 May 1992
  1562.  
  1563.          o  Modified SioReset so that it no longer clears DTR & RTS.
  1564.          o  Modified SioModel & renamed to SioInfo.
  1565.          o  Fixed bug in SioDone when using 2 ports simultaneously.
  1566.          o  Added SioFlow to library.
  1567.          o  Added YMODEM-G protocol to TERM program.
  1568.  
  1569.          Version 3.3 -- 3 August 1992
  1570.  
  1571.          o  Fixed bug in SioUnGet when using 2 ports simultaneously.
  1572.          o  Add SioRead function.
  1573.  
  1574.          Version 3.4 -- 4 Jan 1993
  1575.  
  1576.          o  Library modified to use up to four ports simultaneously.
  1577.          o  SioIRQ was modified to include  third argument.
  1578.          o  EXAMPORT utility distributed to registered users.
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.         PCL4P Users Manual                                     Page 27
  1621.          9.2 Function Summary
  1622.  
  1623.  
  1624.          Refer to the  PCL4P  Reference  Manual  (PCL4P.REF)  for  detailed
  1625.          information  on  the  communications  and support functions. A one
  1626.          line summary of each function follows:
  1627.  
  1628.  
  1629.          SioBaud     Sets the baud rate of the selected port.
  1630.          SioBrkKey   Returns non-zero if the Control-BREAK key was pressed.
  1631.          SioBrkSig   Asserts, cancels, or detects BREAK signal.
  1632.          SioCTS      Reads the Clear to Send (CTS) modem status bit.
  1633.          SioDCD      Reads the Data Carrier Detect (DCD) modem status bit.
  1634.          SioDone     Terminates further serial processing.
  1635.          SioDSR      Reads the Data Set Ready (DSR) modem status bit.
  1636.          SioDTR      Set, clear, or read the Data Terminal Ready (DTR) bit.
  1637.          SioError    Displays error in text.
  1638.          SioFIFO     Sets the interrupt level for the INS16550.
  1639.          SioFlow     Enables / disables hardware flow control.
  1640.          SioGetc     Reads the next character from the serial line.
  1641.          SioInfo     Returns library version number.
  1642.          SioIRQ      Assigns an IRQ line and interrupt service to a port.
  1643.          SioLine     Reads the line status register.
  1644.          SioLoopBack Performs a UART loopback test.
  1645.          SioModem    Reads the modem status register.
  1646.          SioParms    Sets parity, stop bits, and word length.
  1647.          SioPutc     Transmit a character over a serial line.
  1648.          SioReset    Initialize a serial port for processing.
  1649.          SioRI       Reads the Ring Indicator (RI) modem status bit.
  1650.          SioRTS      Sets, clears, or reads the Request to Send (RTS) line.
  1651.          SioRxBuf    Sets up receive buffer.
  1652.          SioRxFlush  Flushes (clears) the receive buffer.
  1653.          SioRxQue    Returns the number of characters in the receive queue.
  1654.          SioTimer    Returns the number of system clock tics.
  1655.          SioUART     Sets the UART base address.
  1656.          SioUnGetc   "Un-gets" (puts back) a specified character.
  1657.  
  1658.  
  1659.          9.3 Further Reading
  1660.  
  1661.  
  1662.          The best way to learn about serial communications  is  to  read  a
  1663.          good  book  on the subject. Several good texts are available.  Two
  1664.          that I like are (sorry but most communications  books  use  C  for
  1665.          their examples) :
  1666.  
  1667.          (1) C Programmers's Guide to Serial Communications by Joe Campbell
  1668.          (SAMS)
  1669.  
  1670.          (2) Mastering Serial Communications by Peter Gofton (SYBEX).
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.         PCL4P Users Manual                                     Page 28
  1681.          10.0 Other MarshallSoft Computing Products
  1682.  
  1683.          10.1 The Personal Communications Library for C
  1684.  
  1685.          The Personal Communications Library for  Pascal  (PCL4C)  is  a  C
  1686.          language  version  of  the  Personal  Communications  Library  for
  1687.          Pascal, and is available for $55 plus $3 S&H ($6 S&H overseas). It
  1688.          contains   the   same   library   functions,   example   programs,
  1689.          documentation, and user support.
  1690.  
  1691.          10.2 The Personal Protocol Library for C
  1692.  
  1693.          The  Personal  Protocol  Library for C (PPL4C) consists of a state
  1694.          driven C language library  which  implements  XMODEM,  XMODEM-CRC,
  1695.          XMODEM-1K, XMODEM-G, YMODEM, and YMODEM-G file transfer protocols.
  1696.          This  allows  the  communications  application  to  run  two ports
  1697.          simultaneously while interacting with the user  at  the  keyboard.
  1698.          The  state  drive library functionally emulates background tasking
  1699.          with standard MSDOS.
  1700.  
  1701.          The primary application area for the protocol library  is  in  the
  1702.          development  of custom BBS programs (and programs that call BBS's)
  1703.          which  require  either  multiple  lines  or  which  require   user
  1704.          interaction  while  a  file transfer is underway. The state driven
  1705.          architecture can  also  be  used  as  a  framework  and  guide  to
  1706.          developing customized file transfer protocols.
  1707.  
  1708.          The protocol library (PPL4C) requires the C communications library
  1709.          PCL4C.   The  PPL4C  comes  with fully commented C source code, an
  1710.          example  program  which  can  transmit  or   receive   two   files
  1711.          simultaneously,  printed documentation, and one year of telephone,
  1712.          FAX, and BBS support.
  1713.  
  1714.          The Personal Protocol Library for C is available for $35  plus  $3
  1715.          S&H ($6 S&H overseas).  It can also be ordered together with the C
  1716.          communications  library  for  $65  for  both,  plus  $3.50 S&H ($7
  1717.          overseas).
  1718.  
  1719.          10.3 The Personal Protocol Library for Pascal
  1720.  
  1721.          The Personal Protocol Library for Pascal (PPL4P) is a Turbo Pascal
  1722.          version  of  the Personal Protocol Library for C, and is available
  1723.          for $35 plus $3 S&H ($6  S&H  overseas).   It  contains  the  same
  1724.          library  functions,  example  programs,  documentation,  and  user
  1725.          support.
  1726.  
  1727.          The Personal Protocol Library for Pascal is available for $35 plus
  1728.          $3  S&H  ($6  S&H overseas).  It can also be ordered together with
  1729.          the Pascal communications library for $65 for both, plus $3.50 S&H
  1730.          ($7 overseas).
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.         PCL4P Users Manual                                     Page 29
  1741.  
  1742.